home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
u_man
/
cat3
/
Tk
/
crterrhdlr.z
/
crterrhdlr
Wrap
Text File
|
1998-10-30
|
12KB
|
199 lines
TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr((((3333TTTTkkkk)))) TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr((((3333TTTTkkkk))))
NNNNAAAAMMMMEEEE
Tk_CreateErrorHandler, Tk_DeleteErrorHandler - handle X protocol errors
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
####iiiinnnncccclllluuuuddddeeee <<<<ttttkkkk....hhhh>>>>
Tk_ErrorHandler
TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr(_d_i_s_p_l_a_y, _e_r_r_o_r, _r_e_q_u_e_s_t, _m_i_n_o_r, _p_r_o_c, _c_l_i_e_n_t_D_a_t_a)
TTTTkkkk____DDDDeeeelllleeeetttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr(_h_a_n_d_l_e_r)
AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
Display *_d_i_s_p_l_a_y (in) Display whose errors are to be
handled.
int _e_r_r_o_r (in) Match only error events with
this value in the _e_r_r_o_r__c_o_d_e
field. If -1, then match any
_e_r_r_o_r__c_o_d_e value.
int _r_e_q_u_e_s_t (in) Match only error events with
this value in the _r_e_q_u_e_s_t__c_o_d_e
field. If -1, then match any
_r_e_q_u_e_s_t__c_o_d_e value.
int _m_i_n_o_r (in) Match only error events with
this value in the _m_i_n_o_r__c_o_d_e
field. If -1, then match any
_m_i_n_o_r__c_o_d_e value.
Tk_ErrorProc *_p_r_o_c (in) Procedure to invoke whenever an
error event is received for
_d_i_s_p_l_a_y and matches _e_r_r_o_r,
_r_e_q_u_e_s_t, and _m_i_n_o_r. NULL means
ignore any matching errors.
ClientData _c_l_i_e_n_t_D_a_t_a (in) Arbitrary one-word value to pass
to _p_r_o_c.
Tk_ErrorHandler _h_a_n_d_l_e_r (in) Token for error handler to
delete (return value from a
previous call to
TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr).
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr arranges for a particular procedure (_p_r_o_c) to be
called whenever certain protocol errors occur on a particular display
(_d_i_s_p_l_a_y). Protocol errors occur when the X protocol is used
incorrectly, such as attempting to map a window that doesn't exist. See
the Xlib documentation for XXXXSSSSeeeettttEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr for more information on the
kinds of errors that can occur. For _p_r_o_c to be invoked to handle a
PPPPaaaaggggeeee 1111
TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr((((3333TTTTkkkk)))) TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr((((3333TTTTkkkk))))
particular error, five things must occur:
[1] The error must pertain to _d_i_s_p_l_a_y.
[2] Either the _e_r_r_o_r argument to TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr must have been
-1, or the _e_r_r_o_r argument must match the _e_r_r_o_r__c_o_d_e field from the
error event.
[3] Either the _r_e_q_u_e_s_t argument to TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr must have been
-1, or the _r_e_q_u_e_s_t argument must match the _r_e_q_u_e_s_t__c_o_d_e field from
the error event.
[4] Either the _m_i_n_o_r argument to TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr must have been
-1, or the _m_i_n_o_r argument must match the _m_i_n_o_r__c_o_d_e field from the
error event.
[5] The protocol request to which the error pertains must have been made
when the handler was active (see below for more information).
_P_r_o_c should have arguments and result that match the following type:
typedef int Tk_ErrorProc(
ClientData _c_l_i_e_n_t_D_a_t_a,
XErrorEvent *_e_r_r_E_v_e_n_t_P_t_r);
The _c_l_i_e_n_t_D_a_t_a parameter to _p_r_o_c is a copy of the _c_l_i_e_n_t_D_a_t_a argument
given to TTTTccccllll____CCCCrrrreeeeaaaatttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr when the callback was created.
Typically, _c_l_i_e_n_t_D_a_t_a points to a data structure containing application-
specific information that is needed to deal with the error. _E_r_r_E_v_e_n_t_P_t_r
is a pointer to the X error event. The procedure _p_r_o_c should return an
integer value. If it returns 0 it means that _p_r_o_c handled the error
completely and there is no need to take any other action for the error.
If it returns non-zero it means _p_r_o_c was unable to handle the error.
If a value of NULL is specified for _p_r_o_c, all matching errors will be
ignored: this will produce the same result as if a procedure had been
specified that always returns 0.
If more than more than one handler matches a particular error, then they
are invoked in turn. The handlers will be invoked in reverse order of
creation: most recently declared handler first. If any handler returns
0, then subsequent (older) handlers will not be invoked. If no handler
returns 0, then Tk invokes X'es default error handler, which prints an
error message and aborts the program. If you wish to have a default
handler that deals with errors that no other handler can deal with, then
declare it first.
The X documentation states that ``the error handler should not call any
functions (directly or indirectly) on the display that will generate
protocol requests or that will look for input events.'' This restriction
applies to handlers declared by TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr; disobey it at your
own risk.
PPPPaaaaggggeeee 2222
TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr((((3333TTTTkkkk)))) TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr((((3333TTTTkkkk))))
TTTTkkkk____DDDDeeeelllleeeetttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr may be called to delete a previously-created error
handler. The _h_a_n_d_l_e_r argument identifies the error handler, and should
be a value returned by a previous call to TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEEvvvveeeennnnttttHHHHaaaannnnddddlllleeeerrrr.
A particular error handler applies to errors resulting from protocol
requests generated between the call to TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr and the call
to TTTTkkkk____DDDDeeeelllleeeetttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr. However, the actual callback to _p_r_o_c may not
occur until after the TTTTkkkk____DDDDeeeelllleeeetttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr call, due to buffering in the
client and server. If an error event pertains to a protocol request made
just before calling TTTTkkkk____DDDDeeeelllleeeetttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr, then the error event may not
have been processed before the TTTTkkkk____DDDDeeeelllleeeetttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr call. When this
situation arises, Tk will save information about the handler and invoke
the handler's _p_r_o_c later when the error event finally arrives. If an
application wishes to delete an error handler and know for certain that
all relevant errors have been processed, it should first call
TTTTkkkk____DDDDeeeelllleeeetttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr and then call XXXXSSSSyyyynnnncccc; this will flush out any
buffered requests and errors, but will result in a performance penalty
because it requires communication to and from the X server. After the
XXXXSSSSyyyynnnncccc call Tk is guaranteed not to call any error handlers deleted before
the XXXXSSSSyyyynnnncccc call.
For the Tk error handling mechanism to work properly, it is essential
that application code never calls XXXXSSSSeeeettttEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr directly; applications
should use only TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr.
KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
callback, error, event, handler
PPPPaaaaggggeeee 3333